FROM maven:3.6.3-openjdk-8-slim as build
COPY . /opt
RUN cd /opt && mvn install 

FROM openjdk:8-jdk-slim

COPY --from=build /opt/build /opt
COPY --from=build /opt/datax /opt/datax
COPY --from=build /opt/start.sh /opt
ENV MODULE=datax-admin ADMIN_ADDRESS=admin MYSQL_HOST=mysql MYSQL_PORT=3306 USERNAME=root PASSWORD=root
WORKDIR /opt
RUN tar -zxvf datax-web-2.1.2.tar.gz && ./datax-web-2.1.2/bin/install.sh --force \
    && rm -rf datax-web-2.1.2.tar.gz \
    && rm -rf datax-web-2.1.2/packages
#admin[9527] executor[9999]
EXPOSE 9527 9999
CMD sh /opt/start.sh